package com.roc.web.action.windcontroll;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;

public class SwitchSearchCondition extends BaseSearchCondition {
	
	private String mchtId;//卡号或商户号
	private String transCd;
	private String orgCode;
	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();
		if(Constance.isNotEmpty(orgCode))
		{
			filedBeanList.add(new WhereHQLFieldBean("T.INS_CD", orgCode,"=", false));
		}
		if(Constance.isNotEmpty(mchtId))
		{
			filedBeanList.add(new WhereHQLFieldBean("T.MCHT_CD", mchtId,"=", false));
		}
		if(Constance.isNotEmpty(transCd))
		{
			filedBeanList.add(new WhereHQLFieldBean("T.TRANS_CD", transCd,"=", false));
		}
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		StringBuffer sb=new StringBuffer();
		sb.append(" SELECT COUNT(1) FROM  APSTFR.TBL_MGM_RISK_TIME T WHERE 1=1 ");
		return sb.toString();
	}

	@Override
	protected String getSearchHQL() {
		StringBuffer sb=new StringBuffer();
		sb.append(" SELECT T.INS_CD,T.MCHT_CD,T.TRANS_CD,T.BEGIN_TIME,T.END_TIME,T.USE_FLAG FROM  APSTFR.TBL_MGM_RISK_TIME T WHERE 1=1 ");
		return sb.toString();
	}

	@Override
	protected String getOrderPartOfHQL() {
		// TODO Auto-generated method stub
		return " ORDER BY T.MCHT_CD ";
	}

	public String getMchtId() {
		return mchtId;
	}

	public void setMchtId(String mchtId) {
		this.mchtId = mchtId;
	}

	public String getOrgCode() {
		return orgCode;
	}

	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}

	public String getTransCd() {
		return transCd;
	}

	public void setTransCd(String transCd) {
		this.transCd = transCd;
	}
	
}
